package com.example.demo.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.List;
import java.util.Objects;

@Entity
public class Bjinfo {
    private int bjId;
    private String zt;
    private String zcdd;
    private Integer bjdh;
    private String bkfl;
    private String bz;
    private BigDecimal hl;
    private Date bjdate;
    private BigDecimal zbj;
    private BigDecimal ygml;
    private Client kh;
    private Xsjhinfo xsjh;
    private Bjxqinfo bjxq;
    private List<Bjmxinfo> bjmx;

    @Id
    @Column(name = "bjId", nullable = false)
    public int getBjId() {
        return bjId;
    }

    public void setBjId(int bjId) {
        this.bjId = bjId;
    }

    @Basic
    @Column(name = "zt", nullable = true, length = 20)
    public String getZt() {
        return zt;
    }

    public void setZt(String zt) {
        this.zt = zt;
    }

    @Basic
    @Column(name = "zcdd", nullable = true, length = 10)
    public String getZcdd() {
        return zcdd;
    }

    public void setZcdd(String zcdd) {
        this.zcdd = zcdd;
    }

    @Basic
    @Column(name = "bjdh", nullable = true)
    public Integer getBjdh() {
        return bjdh;
    }

    public void setBjdh(Integer bjdh) {
        this.bjdh = bjdh;
    }

    @Basic
    @Column(name = "bkfl", nullable = true, length = 10)
    public String getBkfl() {
        return bkfl;
    }

    public void setBkfl(String bkfl) {
        this.bkfl = bkfl;
    }

    @Basic
    @Column(name = "bz", nullable = true, length = 10)
    public String getBz() {
        return bz;
    }

    public void setBz(String bz) {
        this.bz = bz;
    }

    @Basic
    @Column(name = "hl", nullable = true, precision = 2)
    public BigDecimal getHl() {
        return hl;
    }

    public void setHl(BigDecimal hl) {
        this.hl = hl;
    }

    @Basic
    @Column(name = "bjdate", nullable = true)
    public Date getBjdate() {
        return bjdate;
    }

    public void setBjdate(Date bjdate) {
        this.bjdate = bjdate;
    }

    @Basic
    @Column(name = "zbj", nullable = true, precision = 2)
    public BigDecimal getZbj() {
        return zbj;
    }

    public void setZbj(BigDecimal zbj) {
        this.zbj = zbj;
    }

    @Basic
    @Column(name = "ygml", nullable = true, precision = 2)
    public BigDecimal getYgml() {
        return ygml;
    }

    public void setYgml(BigDecimal ygml) {
        this.ygml = ygml;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Bjinfo bjinfo = (Bjinfo) o;
        return bjId == bjinfo.bjId &&
                Objects.equals(zt, bjinfo.zt) &&
                Objects.equals(zcdd, bjinfo.zcdd) &&
                Objects.equals(bjdh, bjinfo.bjdh) &&
                Objects.equals(bkfl, bjinfo.bkfl) &&
                Objects.equals(bz, bjinfo.bz) &&
                Objects.equals(hl, bjinfo.hl) &&
                Objects.equals(bjdate, bjinfo.bjdate) &&
                Objects.equals(zbj, bjinfo.zbj) &&
                Objects.equals(ygml, bjinfo.ygml);
    }

    @Override
    public int hashCode() {
        return Objects.hash(bjId, zt, zcdd, bjdh, bkfl, bz, hl, bjdate, zbj, ygml);
    }

    @ManyToOne
    @JoinColumn(name = "khId", referencedColumnName = "client_id")
    public Client getKh() {
        return kh;
    }

    public void setKh(Client kh) {
        this.kh = kh;
    }

    @ManyToOne
    @JoinColumn(name = "xsjhId", referencedColumnName = "xsjhId")
    public Xsjhinfo getXsjh() {
        return xsjh;
    }

    public void setXsjh(Xsjhinfo xsjh) {
        this.xsjh = xsjh;
    }

    @OneToOne
    @JoinColumn(name = "bjId", referencedColumnName = "bjId", nullable = false)
    public Bjxqinfo getBjxq() {
        return bjxq;
    }

    public void setBjxq(Bjxqinfo bjxq) {
        this.bjxq = bjxq;
    }

    @OneToMany(mappedBy = "bj")
    public List<Bjmxinfo> getBjmx() {
        return bjmx;
    }

    public void setBjmx(List<Bjmxinfo> bjmx) {
        this.bjmx = bjmx;
    }
}
